#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main()
{
	char str[10001] = { 0 };
	int row = 0;
	while (gets(str))
	{
		char* ptr = str;
		char* word[10000] = { NULL };
		while (*ptr != '\0')
		{
			if (('z' >= *ptr && *ptr >= 'a') || ('Z' >= *ptr && 'A' <= *ptr))
			{
				word[row++] = ptr;
				while ((*ptr != '\0')
					&& (('z' >= *ptr && *ptr >= 'a') || ('Z' >= *ptr && 'A' <= *ptr))) ptr++;
				//continue;
			}
			*ptr = '\0';
			ptr++;
		}
		for (int i = row - 1; i >= 0; i--)
		{
			printf("%s ", word[i]);
		}
		printf("\n");
	}
	return 0;
}
